package com.lc.luzhengtang.adapter;

import android.content.Intent;
import android.view.View;
import android.view.ViewGroup;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lc.luzhengtang.R;
import com.lc.luzhengtang.activity.DayConsumptionActivity;
import com.lc.luzhengtang.bean.ConsumptionBean;
import com.zcx.helper.scale.ScaleScreenHelperFactory;

import java.util.List;

/**
 * 文 件 名: NewsListAdapter
 * 创 建 人: zhangyu
 * 创建日期: 16/12/24 19:55
 * 邮   箱: yuanchong121@gmail.com
 * 修改时间：
 * 修改备注：
 */
public class ConsumptionListAdapter extends BaseQuickAdapter<ConsumptionBean.DataBeanX.DataBean, BaseViewHolder> {
    public ConsumptionListAdapter(List<ConsumptionBean.DataBeanX.DataBean> data) {

        super(R.layout.item_consumption, data);
    }


    @Override
    protected void convert(BaseViewHolder helper, final ConsumptionBean.DataBeanX.DataBean item) {
        ScaleScreenHelperFactory.getInstance().loadView((ViewGroup) helper.convertView);
        helper.setText(R.id.text_username, item.getCreate_time() + "");
        helper.setText(R.id.text_purchase, item.getZongmoney());
        helper.setText(R.id.text_shouyi, item.getZongtotal());
        helper.setTag(R.id.text_username, helper.getAdapterPosition());
        helper.setTag(R.id.text_purchase, helper.getAdapterPosition());

        View view = helper.getConvertView();
        view.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.putExtra("create_time", item.getCreate_time() + "");
                intent.putExtra("buyuser_id", item.getBuyuser_id() + "");
                intent.setClass(mContext, DayConsumptionActivity.class);
                mContext.startActivity(intent);

            }
        });


    }


}
